import Router from '@koa/router';
import logger from '../logger.js';
import response from '../response.js';
import business from '../business.js';
 


const router = new Router;
router.prefix('/camera');

router.post('/plateReport', async (ctx) => {
let body = ctx.request.body;
if (!body.AlarmInfoPlate) {
    ctx.body = response.fail('请求参数错误');
    return;
}
let AlarmInfoPlate = body.AlarmInfoPlate;
// console.log('sn:',AlarmInfoPlate.serialno);
// console.log('plate:',AlarmInfoPlate.result.PlateResult.license);
await business.plateReport(AlarmInfoPlate.serialno,AlarmInfoPlate.result.PlateResult.license,AlarmInfoPlate.result.PlateResult.imageFile);
AlarmInfoPlate.result.PlateResult.imageFile='';
console.log('接收到相机上报的车牌识别结果:',JSON.stringify(AlarmInfoPlate));
ctx.body = response.success();
});






export { router };